class Stack {
  constructor() {
    this.items = {};
    this.count = 0;
  }
  push(val) {
    this.items[this.count] = val;
    this.count++;
  }
  isEmpty() {
    return this.count === 0;
  }
  pop() {
    if (this.isEmpty()) {
      return undefined;
    }
    let result = this.items[this.count];
    delete this.items[this.count];
    this.count--;
    return result;
  }
  size() {
    return this.count;
  }
}
let stack = new Stack();
console.log(stack);
stack.push(1);
stack.push("123");
console.log(stack);
stack.pop();
console.log(stack);
console.log(stack.size());
